﻿/*----------------------------------------------------------------
//文件名：IDNameObj.cs
//文件功能描述：用来传递最基本的ID和名称对象。
//创建人：赵国伟
//创建时间：2011-11-09 17:16:00
//----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Shopping.Common
{
    /// <summary>
    /// 存储基本的ID和Name值；
    /// </summary>
    [Serializable]
    public class IDNameObj
    {
        #region "私有成员"
        private int _id;
        private string _name;
        #endregion

        #region "公共属性"
        public int ID
        {
            get { return _id; }
            set { _id = value; }
        }

        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }
        #endregion

        #region "构造方法"
        public IDNameObj()
        {

        }

        public IDNameObj(int id, string name)
        {
            this._id = id;
            this._name = name;
        }
        #endregion

        #region 公共方法
        /// <summary>
        /// 将自身序列化为Json对象
        /// </summary>
        public string ToJsonString()
        {
            return JSONHelper.ObjectToJson<IDNameObj>(this);
        }
        #endregion


    }
}
